package com.easylinkin.linkappapi.ruleengine.controller;


import com.easylinkin.linkappapi.annotation.CommonOperateLogAnnotate;
import com.easylinkin.linkappapi.operatelog.constant.LogConstant.LogModule;
import com.easylinkin.linkappapi.ruleengine.service.DataFlushService;
import javax.annotation.Resource;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

/**
 * <p>
 * 数据刷新 控制器
 * </p>
 *
 * @author TongJie
 * @since 2020-08-24
 */
@RestController
@Api(value="数据刷新",tags={"数据刷新"})
@RequestMapping("/dataFlush")
public class DataFlushController {

    @Resource
    private DataFlushService service;

    @ApiOperation("刷型号更新引起的脏数据")
    @PostMapping("flushDeviceUnitDataDifferentFromTenantRefDeviceUnitGlobal")
    @CommonOperateLogAnnotate(module = LogModule.DATA_FLUSH, desc = "flushDeviceUnitDataDifferentFromTenantRefDeviceUnitGlobal")
    public RestMessage flushDeviceUnitDataDifferentFromTenantRefDeviceUnitGlobal() {
        return RestBuilders.successBuilder(service.flushDeviceUnitDataDifferentFromTenantRefDeviceUnitGlobal(null)).build();
    }

    @ApiOperation("规则表达式逻辑符以及排序的刷新")
    @PostMapping("clearIntelligentExpressionSortAndLogicDataGlobal")
    @CommonOperateLogAnnotate(module = LogModule.DATA_FLUSH, desc = "clearIntelligentExpressionSortAndLogicDataGlobal")
    public RestMessage clearIntelligentExpressionSortAndLogicDataGlobal() {
        return RestBuilders.successBuilder(service.clearIntelligentExpressionSortAndLogicDataGlobal()).build();
    }

}
